package com.herui.ota.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.*;

import com.herui.ota.enums.UpdateStateEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

/**
 * table name:  t_device_ota
 * author name: amanda.shan
 * create time: 2023-10-26 13:19:07
 */ 
@Data
@ApiModel
@Accessors(chain = true)
@TableName("t_device_ota")
public class DeviceOta extends LightBaseEntity{

	@TableId(type = IdType.AUTO)
	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty(value = "id")
	private Integer id;

	@ApiModelProperty(value = "品牌")
	private String brand;

	@ApiModelProperty(value = "打印类型")
	private String printType;

	@ApiModelProperty(value = "市场")
	private String market;

	@ApiModelProperty(value = "产品状态")
	private String state;
	@ApiModelProperty(value = "产品型号")
	private String series;

	public String getTreeInfo(){
		StringBuilder treeInfo = new StringBuilder();
		if (!StringUtils.isEmpty(brand)){
			treeInfo.append(brand);
		}
		if (!StringUtils.isEmpty(printType)){
			treeInfo.append("-");
			treeInfo.append(printType);
		}
		if (!StringUtils.isEmpty(market)){
			treeInfo.append("-");
			treeInfo.append(market);
		}
		if (!StringUtils.isEmpty(series)){
			treeInfo.append("-");
			treeInfo.append(series);
		}
		return treeInfo.toString();
	}

	public boolean isSame(DeviceOta deviceOta){
		if (!brand.equals(deviceOta.getBrand())){
			return false;
		}else if (!printType.equals(deviceOta.getPrintType())){
			return false;
		}else if (!market.equals(deviceOta.getMarket())){
			return false;
		}else if (!series.equals(deviceOta.getSeries())){
			return false;
		}
		return true;
	}
}

